﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;
using System.Configuration;

namespace SIS.Utilities.Mail
{
    public class MailClient
    {
        string smtp_noreply_host = string.Empty;
        int smtp_noreply_webport = 25;
        int smtp_noreply_netport = 25;
        string smtp_noreply_account = string.Empty;
        string smtp_noreply_authcode = string.Empty;
        bool smtp_noreply_enablessl = true;

        string smtp_editor_host = string.Empty;
        int smtp_editor_webport = 25;
        int smtp_editor_netport = 25;
        string smtp_editor_account = string.Empty;
        string smtp_editor_authcode = string.Empty;
        bool smtp_editor_enablessl = true;

        public MailClient()
        {
            try
            {
                smtp_noreply_host = System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPHostName"].ToString();
                smtp_noreply_webport = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPWebPort"].ToString());
                smtp_noreply_netport = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPNetPort"].ToString());
                smtp_noreply_account = System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPAccount"].ToString();
                smtp_noreply_authcode = System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPAuthCode"].ToString();
                smtp_noreply_enablessl = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["SIS.NoreplySMTPSslEnable"].ToString());

                smtp_editor_host = System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPHostName"].ToString();
                smtp_editor_webport = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPWebPort"].ToString());
                smtp_editor_netport = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPNetPort"].ToString());
                smtp_editor_account = System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPAccount"].ToString();
                smtp_editor_authcode = System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPAuthCode"].ToString();
                smtp_editor_enablessl = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["SIS.EditorSMTPSslEnable"].ToString());
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }

        //NOREPLY MAIL
        public bool SendNetNoreplyMailAsync(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendNetMailAsync(smtp_noreply_host, smtp_noreply_netport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl);
        }

        public bool SendWebNoreplyMail(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendWebMail(smtp_noreply_host, smtp_noreply_webport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl);
        }

        public bool SendNetNoreplyMail(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendNetMail(smtp_noreply_host, smtp_noreply_netport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl);
        }


        public bool SendNetNoreplyMailByAttachementsAsync(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendNetMailByAttachmentsAsync(smtp_noreply_host, smtp_noreply_netport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl, fileList);
        }

        public bool SendWebNoreplyMailByAttachements(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendWebMailByAttachments(smtp_noreply_host, smtp_noreply_webport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl, fileList);
        }

        public bool SendNetNoreplyMailByAttachements(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendNetMailByAttachements(smtp_noreply_host, smtp_noreply_netport, smtp_noreply_account, smtp_noreply_authcode, fromName, smtp_noreply_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_noreply_enablessl, fileList);
        }
        //NOREPLY MAIL END




        //EDITOR MAIL
        public bool SendNetEditorMailAsync(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendNetMailAsync(smtp_editor_host, smtp_editor_netport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl);
        }

        public bool SendWebEditorMail(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendWebMail(smtp_editor_host, smtp_editor_webport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl);
        }

        public bool SendNetEditorMail(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail)
        {
            return MailManager.SendNetMail(smtp_editor_host, smtp_editor_netport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl);
        }


        public bool SendNetEditorMailByAttachmentsAsync(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendNetMailByAttachmentsAsync(smtp_editor_host, smtp_editor_netport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl, fileList);
        }

        public bool SendWebEditorMailByAttachments(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendWebMailByAttachments(smtp_editor_host, smtp_editor_webport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl, fileList);
        }

        public bool SendNetEditorMailByAttachments(string Subject, string Body, string fromName, string toName, string toEmail, string ccEmail, string bccEmail, string[] fileList)
        {
            return MailManager.SendNetMailByAttachements(smtp_editor_host, smtp_editor_netport, smtp_editor_account, smtp_editor_authcode, fromName, smtp_editor_account, toName, toEmail, ccEmail, bccEmail, Subject, Body, smtp_editor_enablessl, fileList);
        }
        //EDITOR MAIL END
    }
}
